﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="newmarkup.aspx.cs" Inherits="IGIS.Extensions.markup.newmarkup" %>


<html>
<head>
	<title>New Markup Layer</title>
    <link rel="stylesheet" href="../../styles/gt.css" type="text/css">
	
	<script language="javascript">
		var SET_MARKER_COLOR 		= 1;
		var SET_LINE_COLOR 			= 2;
		var SET_FILL_FORE_COLOR 	= 3;
		var SET_FILL_BACK_COLOR		= 4;
		var SET_BORDER_COLOR 		= 5;
		var SET_LABEL_FORE_COLOR 	= 6;
		var SET_LABEL_BACK_COLOR 	= 7;
		var setColor = 0;
	
		var markerColor = "FF0000";
		var lineColor = "0000FF";
		var fillForeColor = "00FF00";
		var fillBackColor = "00FF00";
		var fillBackTrans = true;
		var borderColor = "000000";
		var labelForeColor = "000000";
		var labelBackColor = "FFFFFF";
		
		function dosubmit()
		{
		    if(newMarkupLayerForm.MARKUPNAME.value=='')
		        newMarkupLayerForm.MARKUPCOMMAND.value = "7"; // MarkupCommand.None 
		    else
		        if(!ValidateInputs()) return;

	        newMarkupLayerForm.submit();
		}
		
		function gohome()
		{
		    newMarkupLayerForm.MARKUPNAME.value='';
            dosubmit();
        }
		
		function PickColor(whichColor, allowTransparency, transparent)
        {
            var clr;
			setColor = whichColor;
			
            if (setColor == SET_MARKER_COLOR)
                clr = markerColor;
            else if (setColor == SET_LINE_COLOR)
                clr = lineColor;
            else if (setColor == SET_FILL_FORE_COLOR)
                clr = fillForeColor;
            else if (setColor == SET_FILL_BACK_COLOR)
                clr = fillBackColor;
            else if (setColor == SET_BORDER_COLOR)
                clr = borderColor;
            else if (setColor == SET_LABEL_FORE_COLOR)
                clr = labelForeColor;
            else if (setColor == SET_LABEL_BACK_COLOR)
                clr = labelBackColor;
           else
                return;
				
            height = allowTransparency? 470: 445;
            w = window.open("colorpicker.aspx?LOCALE=he&CLR=" + clr + "&ALLOWTRANS=" + (allowTransparency? "1":"0") + "&TRANS=" + (transparent?"1":"0"), "colorPicker", "toolbar=no,status=no,width=355,height=" + height);
            w.focus();
        }

        function OnColorPicked(clr, trans)
        {
            if (setColor == SET_MARKER_COLOR)
                markerColor = clr;
            else if (setColor == SET_LINE_COLOR)
                lineColor = clr;
            else if (setColor == SET_FILL_FORE_COLOR)
                fillForeColor = clr;
            else if (setColor == SET_FILL_BACK_COLOR)
			{
                fillBackColor = clr;
				fillBackTrans = trans;
			}
            else if (setColor == SET_BORDER_COLOR)
                borderColor = clr;
            else if (setColor == SET_LABEL_FORE_COLOR)
                labelForeColor = clr;
            else if (setColor == SET_LABEL_BACK_COLOR)
                labelBackColor = clr;
           else
                return;

            UpdateColors();
        }

        function UpdateColors()
        {
            var elt;
            document.getElementById("markerColor").value = markerColor;
            elt = document.getElementById("markerSwatch").style;
            elt.backgroundColor = "#" + markerColor;
            elt.color = "#" + markerColor;

            document.getElementById("lineColor").value = lineColor;
            elt = document.getElementById("lineSwatch").style;
            elt.backgroundColor = "#" + lineColor;
            elt.color = "#" + lineColor;

            document.getElementById("fillForeColor").value = fillForeColor;
            elt = document.getElementById("fillFgSwatch").style;
            elt.backgroundColor = "#" + fillForeColor;
            elt.color = "#" + fillForeColor;

            document.getElementById("fillBackColor").value = fillBackColor;
            document.getElementById("fillBackTrans").value = fillBackTrans;
            elt = document.getElementById("fillBgSwatch").style;
            elt.backgroundColor = fillBackTrans ? "#FFFFFF" : "#" + fillBackColor;
            elt.color = fillBackTrans ? "#000000" : "#" + fillBackColor;

            document.getElementById("borderColor").value = borderColor;
            elt = document.getElementById("borderSwatch").style;
            elt.backgroundColor = "#" + borderColor;
            elt.color = "#" + borderColor;

            document.getElementById("labelForeColor").value = labelForeColor;
            elt = document.getElementById("labelFgSwatch").style;
            elt.backgroundColor = "#" + labelForeColor;
            elt.color = "#" + labelForeColor;

            document.getElementById("labelBackColor").value = labelBackColor;
            elt = document.getElementById("labelBgSwatch").style;
            elt.backgroundColor = "#" + labelBackColor;
            elt.color = "#" + labelBackColor;
        }
      
        
        function ValidateInputs(){
            var result = true;
            
            var chbProjectManager = document.getElementById("LINKTOPROJECTMANAGER");
            var txtProjectGroupName = document.getElementById("ProjectCollectionName");
            var txtProjectCollectionOtherName = document.getElementById("ProjectCollectionOtherName");
            
            if(txtProjectGroupName)
            {
                if(chbProjectManager.checked)
                {
                    var selectedValue = txtProjectGroupName.options[txtProjectGroupName.selectedIndex].innerText;
                    if(selectedValue == "áçø îøùéîä")
                    {
                        txtProjectGroupName.style.backgroundColor = "#ffcccc";
                        result = false;
                    }
                    else
                    {
                        txtProjectGroupName.style.backgroundColor = "#ffffff";
                    }
                    if(selectedValue == "àçø..." && !txtProjectCollectionOtherName.value)
                    {
                        txtProjectCollectionOtherName.style.backgroundColor = "#ffcccc";
                        result = false;
                    }
                    else
                    {
                        txtProjectCollectionOtherName.style.backgroundColor = "#ffffff";
                    }
                }
            }
            return result;
        }
	</script>
	
</head>

<body dir=rtl style="margin:5px">

<% if (errorMsg == null) { %>

<form action="markupmain.aspx" method="post" enctype="application/x-www-form-urlencoded" id="newMarkupLayerForm" target="_self">

<input name="SESSION" type="hidden" value="<%= GetParameter(args, "SESSION") %>">
<input name="MAPNAME" type="hidden" value="<%= GetParameter(args, "MAPNAME") %>">
<input name="MARKUPCOMMAND" type="hidden" value="1"> <!--MarkupCommand.Creat--> 

<table class="RegText" border="0" cellspacing="0" width="100%%">
	<tr><td colspan="3" class="Title">הגדרת שכבה חדשה<hr></td></tr>
    <!--Layer Name-->
	<tr><td colspan="3" class="SubTitle">שם השכבה</td></tr>
	<tr><td colspan="3" style="padding-bottom:5px;padding-top:5px"><input class="Ctrl" name="MARKUPNAME" type=Text value=""><hr></td></tr>
	<!--Markup URL-->
	<tr><td colspan="3" class="SubTitle">הגדרת קישור</td></tr>
	<tr><td colspan="3" style="padding-bottom:5px;padding-top:5px"><input class="Ctrl" name="MARKUPURL" type=Text style="width: 100%"><hr></td></tr>
  
    <!--Point Style-->
	<tr><td colspan="3" class="SubTitle">סגנון נקודה</td></tr>
	<tr>
		<td>סוג הסימון:
<br>
			<select class="Ctrl" name="MARKERTYPE" size="1">
				<option value="Square" selected="selected">ריבוע</option>
				<option value="Circle">עיגול</option>
				<option value="Triangle">משולש</option>
				<option value="Star">כוכב</option>
				<option value="Cross">פלוס</option>
				<option value="X">X</option>
			</select>
		</td>
		<td>
			גודל:<br>
			<input class="Ctrl" name="MARKERSIZE" type="text" value="10" style="width: 35px">נק'
			<input type=hidden  name="MARKERSIZEUNITS"  value="Points"/>
		</td>
		<td>
			צבע:<br>
			<span class="Swatch" id="markerSwatch" style="color: #ff0000; background-color: #ff0000">&nbsp;צבע&nbsp;</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_MARKER_COLOR,false,false)">
		</td>
	</tr>
	<tr><td colspan="3" style="height:10px"></td></tr>
	<!--Polygon Style-->
	<tr><td colspan="3" class="SubTitle">סגנון קו</td></tr>
	<tr>
		<td>
			סוג הקו:<br>
			<select class="Ctrl" name="LINEPATTERN" size="1">
				<option value="Solid" selected="selected">מלא</option>
				<option value="Dash">מקוקו</option>
				<option value="Dot">נקודות</option>
				<option value="DashDot">קו-נקודה</option>
			</select>
		</td>
		<td>
			<input type=hidden name="LINESIZEUNITS" value="Centimeters">
			עובי:<br>
			<input name="LINETHICKNESS" type="text" value="0" style="width: 35px">סמ'
		</td>
		<td>
			צבע:<br>
			<span class="Swatch" id="lineSwatch" style="color: #0000ff; background-color: #0000ff">&nbsp;צבע&nbsp;</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onclick="PickColor(SET_LINE_COLOR,false,false)">
		</td>
	</tr>	
    <!--Polygon Style-->
	<tr><td colspan="3" style="height:10px"></td></tr>
	<tr><td colspan="3" class="SubTitle">סגנון מצולע</td></tr>
	<tr>
		<td >סוג מילוי:<br>
			<select class="Ctrl" name="FILLPATTERN" size="1">
				<option value="Solid" selected>Solid</option>
				<option value="Net">Net</option>
				<option value="Line">Line</option>
				<option value="Line_45">Line_45</option>
				<option value="Line_90">Line_90</option>
				<option value="Line_135">Line_135</option>
				<option value="Square">Square</option>
				<option value="Box">Box</option>
				<option value="Cross">Cross</option>
				<option value="Dash">Dash</option>
				<option value="Dolmit">Dolmit</option>
				<option value="Hex">Hex</option>
				<option value="Sacncr">Sacncr</option>
				<option value="Steel">Steel</option>
			</select>
		</td >
		<td colspan="2">
			שקיפות:<br>
			<input class="Ctrl" name="FILLTRANSPARENCY" type="text"  maxlength="3" value="0" style="width:35px">%
		</td>
	</tr>
	<tr>	
		<td>
			צבע:<br>
			<span class="Swatch" id="fillFgSwatch" style="color: #00ff00; background-color: #00ff00">&nbsp;צבע&nbsp;</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_FILL_FORE_COLOR,false,false)">
		</td >
		<td colspan="2">
			רקע:<br>
			<span class="Swatch" id="fillBgSwatch">&nbsp;רקע&nbsp;</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_FILL_BACK_COLOR,true,fillBackTrans)">
			<br>
		</td>
	</tr>	
	<tr><td colspan="3"><hr></td></tr>
	<tr>
		<td>
			סגנון גבול:<br>
			<select class="Ctrl" name="BORDERPATTERN" size="1">
				<option value="Solid" selected="selected">מלא</option>
				<option value="Dash">מקוקו</option>
				<option value="Dot">נקודות</option>
				<option value="DashDot">קו-נקודה</option>
			</select>
			<input type=hidden name="BORDERSIZEUNITS" value="Centimeters">
		</td>
		<td>
			עובי:<br>
			<input class="Ctrl" name="BORDERTHICKNESS" type="text" value="0" style="width: 35px;">סמ'
		</td>
		<td>
			צבע:<br>
			<span class="Swatch" id="borderSwatch" style="color: #000000; background-color: #000000">צבע</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_BORDER_COLOR,false,false)">
		</td>
	</tr>	

    <!--Lable Style-->
	<tr><td colspan="3" style="height:10px"></td></tr>
	<tr><td colspan="3" class="SubTitle">סגנון תווית</td></tr>
	<tr>
		<td>
			<input type=hidden name="LABELSIZEUNITS" value="Points">
			גודל טקסט:<br>
			<input class="Ctrl" name="LABELFONTSIZE" type="text" value="10" style="width: 35px">נק'
		</td>
		<td>
			צבע טקסט:<br>
			<span class="Swatch" id="labelFgSwatch" style="color: #000000; background-color: #000000">&nbsp;מלא&nbsp;</span>
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_LABEL_FORE_COLOR,false,false)">
		</td>
		<td>
			רקע טקסט:<br>
			<span class="Swatch" id="labelBgSwatch" style="color: #FFFFFF; background-color: #FFFFFF">&nbsp;ללא&nbsp;</span>&nbsp;&nbsp;
			<input class="Ctrl" type="button" value="..." style="width: 22px;" onClick="PickColor(SET_LABEL_BACK_COLOR,false,false)">
			<br>
		</td>
	</tr>	
	<tr>
		<td colspan="3">
			סגנון רקע:<br>
			<select class="Ctrl" name="LABELBACKSTYLE" size="1">
				<option value="Ghosted" selected="selected">חלקי</option>
				<option value="Opaque">מלא</option>
				<option value="Transparent">ללא</option>
			</select>
		</td>
	</tr>	
	<tr>
		<td colspan="3" align="right">
			<hr>
			<input class="Ctrl" type=button onclick="dosubmit()" value="אישור" style="width:60px">
			<input class="Ctrl" type=button onclick="gohome()" value="ביטול" style="width:60px">
		</td>
	</tr>

</table>

<input name="LAYOUT" type="hidden" id="LAYOUT" value="<%= Request["LAYOUT"] %>" />
<input name="MARKERCOLOR" type="hidden" id="markerColor" value="FF0000">
<input name="LINECOLOR" type="hidden" id="lineColor" value="0000FF">
<input name="FILLFORECOLOR" type="hidden" id="fillForeColor" value="00FF00">
<input name="FILLBACKCOLOR" type="hidden" id="fillBackColor" value="00FF00">
<input name="FILLBACKTRANS" type="hidden" id="fillBackTrans" value="true">
<input name="BORDERCOLOR" type="hidden" id="borderColor" value="000000">
<input name="LABELFORECOLOR" type="hidden" id="labelForeColor" value="000000">
<input name="LABELBACKCOLOR" type="hidden" id="labelBackColor" value="FFFFFF">

</form>

<% } else { %>

<table class="RegText" border="0" cellspacing="0" width="100%%">
	<tr><td class="Title">Error<hr></td></tr>
	<tr><td><%= errorMsg %></td></tr>
	<tr><td><%= errorDetail %></td></tr>
</table>

<% } %>

</body>
</html>
